package com.ruoyi.common.rabbitMQ.Service;


import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.UUID;

@Service
public class UserService {

    @Resource
    private RabbitTemplate rabbitTemplate;

    public void register(String username, String password) {

        //模拟用户注册
        String userId = UUID.randomUUID().toString();
        //saveUser(user);

        //发送用户信息给RabbitMQ fanout
        rabbitTemplate.convertAndSend("fanout_user_exchange", "", userId + username);

    }

}
